using System;
using GalaSoft.MvvmLight.Messaging;

namespace SfdClient.Messaging
{
    public class SelectFolderMessage : GenericMessage<string>
    {
        #region ctor
        /// <summary>
        /// Initializes a new instance of the GenericMessage class.
        /// </summary>
        /// <param name="content">The message content.</param>
        /// <param name="callback"></param>
        public SelectFolderMessage(string content, Action<string> callback)
            : base(content)
        {
            Callback = callback;
        }

        /// <summary>
        /// Initializes a new instance of the GenericMessage class.
        /// </summary>
        /// <param name="sender">The message's sender.</param><param name="content">The message content.</param>
        /// <param name="callback"></param>
        public SelectFolderMessage(object sender, string content, Action<string> callback)
            : base(sender, content)
        {
            Callback = callback;
        }

        /// <summary>
        /// Initializes a new instance of the GenericMessage class.
        /// </summary>
        /// <param name="sender">The message's sender.</param><param name="target">The message's intended target. This parameter can be used
        ///             to give an indication as to whom the message was intended for. Of course
        ///             this is only an indication, amd may be null.</param><param name="content">The message content.</param>
        /// <param name="callback"></param>
        public SelectFolderMessage(object sender, object target, string content, Action<string> callback)
            : base(sender, target, content)
        {
            Callback = callback;
        } 
        #endregion

        public Action<string> Callback { get; private set; }

        public void ProcessCallback(string result)
        {
            if (Callback == null)
                return;
            Callback(result);
        }
    }
}